package cn.liyicun.test.dto;

public class MyResultInfo {

    public static final Integer OK = 200;
    public static final Integer ERROR = 100;
    public static final Integer SYS_ERROR = 101;

    public MyResultInfo(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public MyResultInfo(Integer code, String message) {
        this.code = code;
        this.message = message;
    }


    public MyResultInfo() {

    }

    public static MyResultInfo ok() {
        return new MyResultInfo();
    }

    public static MyResultInfo ok(String message) {
        return new MyResultInfo(MyResultInfo.OK, message);
    }

    public static MyResultInfo error(String message) {
        return new MyResultInfo(MyResultInfo.ERROR, message);
    }

    public static MyResultInfo okData(Object data) {
        MyResultInfo r = new MyResultInfo();
        r.setCode(OK);
        r.setData(data);
        return r;
    }


    private Integer code = 0;
    private String message = "";
    private String url;
    private Object data;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public static Integer getOK() {
        return OK;
    }

    public static Integer getERROR() {
        return ERROR;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}